<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>系统状态检查</title>
    <style>
        body { font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; }
        .status { padding: 10px; margin: 10px 0; border-radius: 4px; }
        .success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
        .error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
        button { background-color: #007bff; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; margin: 5px; }
    </style>
</head>
<body>
    <h1>乐康养老管理系统 - 状态检查</h1>
    
    <div class="status success">
        ✅ 前端服务: <a href="http://localhost:80" target="_blank">http://localhost:80</a>
    </div>
    
    <div class="status success">
        ✅ 后端服务: <a href="http://localhost:8080" target="_blank">http://localhost:8080</a>
    </div>
    
    <h2>快速测试</h2>
    <button onclick="testAPI()">测试后端API</button>
    <button onclick="testFrontend()">测试前端页面</button>
    
    <div id="result"></div>
    
    <h2>访问链接</h2>
    <ul>
        <li><a href="http://localhost:80" target="_blank">前端主页</a></li>
        <li><a href="http://localhost:80/#/system/arrangement" target="_blank">任务安排页面</a></li>
        <li><a href="http://localhost:8080/swagger-ui.html" target="_blank">后端API文档</a></li>
    </ul>

    <script>
        function testAPI() {
            fetch('http://localhost:8080/actuator/health')
                .then(response => response.json())
                .then(data => {
                    document.getElementById('result').innerHTML = '<div class="status success">✅ 后端API正常: ' + JSON.stringify(data) + '</div>';
                })
                .catch(error => {
                    document.getElementById('result').innerHTML = '<div class="status error">❌ 后端API连接失败: ' + error.message + '</div>';
                });
        }
        
        function testFrontend() {
            fetch('http://localhost:80')
                .then(response => {
                    if (response.ok) {
                        document.getElementById('result').innerHTML = '<div class="status success">✅ 前端页面正常</div>';
                    } else {
                        document.getElementById('result').innerHTML = '<div class="status error">❌ 前端页面异常: ' + response.status + '</div>';
                    }
                })
                .catch(error => {
                    document.getElementById('result').innerHTML = '<div class="status error">❌ 前端连接失败: ' + error.message + '</div>';
                });
        }
    </script>
</body>
</html>
